<?php

require_once('functions/pageLoad.php');
loginRequired();
$user_session = explode("_", $_SESSION['user']);
$user_id = $user_session[0];

$sql = "SELECT id FROM tradesman WHERE user_id = '".$user_id."'";
$query=mysql_query( $sql ) or die ("Error in query: $sql . " . mysql_error());
$rs=mysql_fetch_assoc($query);
$tradesman_id = $rs['id'];

$sql = "DELETE FROM images WHERE id = '".mysql_real_escape_string($_GET['id'])."' AND tradesman_id = '".$tradesman_id."'";
$query=mysql_query( $sql ) or die ("Error in query: $sql . " . mysql_error());

header("Location: /edit-company-profile");

?>